package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] arr = {"one", "two", "three", "fore", "five"};
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        System.out.println("-----");
        for(String array: arr){
            System.out.println(array);
        }
        System.out.println("-------");
        Collection c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("fore");
        c.add("five");
        Iterator it=c.iterator();
        while(it.hasNext()){
            String str=(String)it.next();
            System.out.println(str);
        }
        System.out.println("------");
        for (Object a:c) {
            String b=(String)a;
            System.out.println(b);
        }
    }
}
